package com.hw.paltfrom.mapper;


import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.hw.paltfrom.pojo.HwDataOverrunstationHistory;
import com.hw.paltfrom.pojo.RankListEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;


import java.util.List;

@Component
public interface HwDataOverrunstationHistoryMapper extends BaseMapper<HwDataOverrunstationHistory> {
    //查询动态检测排行
    @Select("SELECT top 3 Count(*) AS checkedCars,osd.F_OverrunName,(SELECT bos.F_SimpleSpelling from HW_Base_OverrunStation bos WHERE osd.F_OverrunName = bos.F_OverrunName) AS fSimpleSpelling FROM dbo.HW_Data_OverrunStation_History AS osd WHERE CONVERT(varchar(20),osd.D_JCSJ,120) BETWEEN '${startTime}' AND '${endTime}' GROUP BY osd.F_OverrunName ORDER BY checkedCars DESC")
    List<RankListEntity> dtRankList(@Param("startTime")String startTime, @Param("endTime")String endTime);

    //查询静态检测排行
    @Select("SELECT top 3 Count(*) AS checkedCars,osd.F_OverrunName,(SELECT bos.F_SimpleSpelling from HW_Base_OverrunStation bos WHERE osd.F_OverrunName = bos.F_OverrunName) AS fSimpleSpelling FROM dbo.HW_Data_OverrunStation_History AS osd WHERE D_SFCX=1 AND CONVERT(varchar(20),osd.J_JCSJ,120) BETWEEN '${startTime}' AND '${endTime}' GROUP BY osd.F_OverrunName ORDER BY checkedCars DESC")
    List<RankListEntity> jtRankList(@Param("startTime")String startTime, @Param("endTime")String endTime);
}